package il.ac.braude.sona.gui.forms.myforms;

import il.ac.braude.sona.constants.ButtonPermission;
import il.ac.braude.sona.constants.Resources;
import il.ac.braude.sona.entities.ChangeRequest;
import il.ac.braude.sona.gui.forms.FormFrame;
import il.ac.braude.sona.gui.forms.FormPanel;
import il.ac.braude.sona.gui.forms.questions.QTextArea;

import java.util.ArrayList;
/**
 * Form for tester failures report
 * @author  Ofek Ron
 * @author Avihay Avitan
 * @author Nitzan Inbar
 * @author Sasha Rozenthal
 */
@SuppressWarnings("serial")
public class ReportTestFailursForm extends FormFrame {
	private QTextArea failuresDescription= new QTextArea("Failures Description:");
	/**
	 * initializes a new form for the tester to fill in
	 * @param req - the change request for whom the report will be written
	 */
	public ReportTestFailursForm(ChangeRequest req) {
		super(ButtonPermission.ReportTestFailures, Resources.Strings.OK);
		FormPanel form = new FormPanel();
		form.addTitleWithUnderline(ButtonPermission.ReportTestFailures+" for request: "+req.getID());
		form.addTitle("Information system: "+req.getValue("Information System"));
		failuresDescription.setAreaSize(5, 30);
		form.addQuestion(failuresDescription);
		setFormPanel(form);
	}
	/**
	 * initializes a new read only form for the
	 * execution leader
	 * @param list - arguments for the test failures form
	 */
	public ReportTestFailursForm(ArrayList<String> list) {
		super(ButtonPermission.ViewReportFailurs, Resources.Strings.OK);
		FormPanel form = new FormPanel();
		form.addTitleWithUnderline(ButtonPermission.ViewReportFailurs+", request: "+list.get(0));
		form.addTitle("Written by: "+list.get(1)+", Date:"+list.get(2));
		failuresDescription.setAreaSize(5, 30);
		failuresDescription.setDefaultAnswer(list.get(3));
		failuresDescription.setEditable(false);
		form.addQuestion(failuresDescription);
		setFormPanel(form);
	}


}
